package java_book;

public class KyungYeon_jv_4_6 {

	public static void main ( String[] args ) {
		int num = 0;
		int sum = 0;
		
		System.out.println("***** result *****");
		
		for(num=1; num<=100; num++) {
			sum += num; 
		}
		
		System.out.println("1+2+3+...+100 = "+sum+" (for statement)");
		
		num = 1;
		sum = 0;
		
		while(num <= 100){
			sum += num;
			num++;
		}
		
		System.out.println("1+2+3+...+100 = "+sum+" (while statement)");
		
		num = 1;
		sum = 0;
		
		do {
			sum += num;
			num++;
		} while (num <= 100);
		System.out.println("1+2+3+...+100 = "+sum+" (do while statement)");
	}
}
